<template>
  <el-row :gutter="20" style="height: 30px">
    <el-col :span="8" :offset="16">
        <div class="grid-content bg-purple-dark" v-if="name === ''|| name === null" style="margin-top: 10px">
          <el-link icon="fa fa-home fa-2x" @click="gotoHome" :underline="false">&nbsp;返回首页</el-link>&nbsp;&nbsp;&nbsp;
          <el-link @click="registerUser" :underline="false">用户登录</el-link>&nbsp;&nbsp;&nbsp;&nbsp;
          <el-link :underline="false">
            <el-dropdown @command="handleCommand">
              <span class="el-dropdown-link">
                用户注册<i class="el-icon-arrow-down el-icon--right"></i>
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item icon="fa fa-user" command="1">&nbsp;个人注册&nbsp;&nbsp;&nbsp;</el-dropdown-item>
                <el-dropdown-item icon="fa fa-compass"  command="2">&nbsp;企业注册&nbsp;&nbsp;&nbsp;</el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </el-link>&nbsp;&nbsp;&nbsp;
          <el-link @click="gotoUrl('/wechat/image')" :underline="false">微信图片管理</el-link>&nbsp;&nbsp;&nbsp;&nbsp;
          <el-link @click="gotoUrl('/wechat/video')" :underline="false">微信视频管理</el-link>&nbsp;&nbsp;&nbsp;&nbsp;
        </div>
        <div class="headerInfo" v-else  style="margin-top: 10px">
          <el-link icon="fa fa-home fa-2x" @click="gotoHome" :underline="false">&nbsp;返回首页</el-link>
          <el-link :underline="false">您好，{{name}}</el-link>
          <el-link @click="doLogout" :underline="false">【退出】</el-link>
        </div>
    </el-col>
  </el-row>
</template>

<script>
export default {
  name: "Personinfo",
  data(){
    return {
      name:''
    }
  },
  mounted() {
    this.name = sessionStorage.getItem("name");
  },
  methods:{
    doLogout(){
      sessionStorage.removeItem("token");
      sessionStorage.removeItem("name");
      this.$router.push("login");
    },
    registerUser(){
      // this.$message('注册用户');
      /*this.$message({
        showClose: true,
        message: '注册用户'
      });*/
      this.$router.push("Login");
    },
    handleCommand(cmd){
      if(cmd === '1'){
        this.$router.push("PersonalReg");
      }else if(cmd === '2'){
        this.$router.push("EnterpriseReg");
      }
    },
    gotoPersonInfoPage() {
      this.$router.push("PersonInfoPage");
    },
    gotoHome(){
      this.$router.push("home");
    },
    gotoUrl(url){
      this.$router.push(url);
    }
  }
}
</script>

<style scoped>
el-link{
  font-size: 16px;
}
.headerInfo{
  font-size: 24px;
  /*font-family: '黑体'!important;*/
  font-family: '微软雅黑'!important;
  /*background-color: white;*/
}
/deep/ .el-icon--right{
  display: none;
}
</style>